package com.batchaps.classes;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import com.batchaps.global.GameEngine;

public class Path {
	
	private float _posX;
	private float _posY;

	private float _sizeX;
	private float _sizeY;
	
	private int _width;
	private int _height;
	
	private int kind;

	public Path(int kind , float pX , float pY , float sizeX , float sizeY , int width , int height){
		
		_posX = pX;
		_posY = pY;
		
		_sizeX = sizeX;
		_sizeY = sizeY;
		
		_width = width;
		_height = height;
	}
	
	public Image GetPathHorizontal(){
		Image result = null;
		try {
			result = Image.createImage(GameEngine.PATH_HORIZONTAL);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return result;
	}
	
	public Image GetPathVertical(){
		Image result = null;
		try {
			result = Image.createImage(GameEngine.PATH_VERTICAL);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return result;
	}
	
	public Image GetPathTurned(){
		Image result = null;
		try {
			result = Image.createImage(GameEngine.PATH_TURNED);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return result;
	}
	public void DrawPath(Graphics g){
		switch(kind){
		case 1://draw horizontal
			g.drawImage(GetPathHorizontal(), (int)_posX, (int)_posY, 0);
			break;
		case 2://draw vertical
			g.drawImage(GetPathVertical(), (int)_posX, (int)_posY, 0);
			break;
		case 3://draw turn
			g.drawImage(GetPathTurned(), (int)_posX, (int)_posY, 0);
			break;
		}
	}

	/**
	 * @return the _sizeX
	 */
	public float get_sizeX() {
		return _sizeX;
	}

	/**
	 * @param _sizeX the _sizeX to set
	 */
	public void set_sizeX(float _sizeX) {
		this._sizeX = _sizeX;
	}

	/**
	 * @return the _sizeY
	 */
	public float get_sizeY() {
		return _sizeY;
	}

	/**
	 * @param _sizeY the _sizeY to set
	 */
	public void set_sizeY(float _sizeY) {
		this._sizeY = _sizeY;
	}

	/**
	 * @return the _width
	 */
	public int get_width() {
		return _width;
	}

	/**
	 * @param _width the _width to set
	 */
	public void set_width(int _width) {
		this._width = _width;
	}

	/**
	 * @return the _height
	 */
	public int get_height() {
		return _height;
	}

	/**
	 * @param _height the _height to set
	 */
	public void set_height(int _height) {
		this._height = _height;
	}
	
	/**
	 * @return the kind
	 */
	public int getKind() {
		return kind;
	}

	/**
	 * @param kind the kind to set
	 */
	public void setKind(int kind) {
		this.kind = kind;
	}
	
	/**
	 * @return the _posX
	 */
	public float get_posX() {
		return _posX;
	}

	/**
	 * @param _posX the _posX to set
	 */
	public void set_posX(float _posX) {
		this._posX = _posX;
	}

	/**
	 * @return the _posY
	 */
	public float get_posY() {
		return _posY;
	}

	/**
	 * @param _posY the _posY to set
	 */
	public void set_posY(float _posY) {
		this._posY = _posY;
	}
}
